<template>
  <div style="width:100%" class="tableContainer">
    <el-table :data="tableData" border style="width: 100%;height:100%">
      <el-table-column prop="fxDate" label="日期"></el-table-column>
      <el-table-column prop="tempMin" label="最低温度"></el-table-column>
      <el-table-column prop="tempMax" label="最高温度"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import { next7d } from '@/api/weather'

export default {
  props: {
    location: String
  },
  created() {
    this.getWeather()
  },
  data() {
    return {
      tableData: []
    }
  },
  methods: {
    getWeather() {
      return next7d(this.location).then(r => (this.tableData = r.data.daily))
    }
  }
}
</script>

<style scoped>
.tableContainer /deep/ .el-table,
.el-table__expanded-cell {
  background-color: transparent;
}
.tableContainer /deep/ .el-table tr {
  background-color: transparent !important;
}
.tableContainer /deep/ .el-table tr:hover td {
  background: transparent;
}
.tableContainer /deep/ .el-table--enable-row-transition .el-table__body td,
.el-table .cell {
  background-color: transparent;
  color: white;
}
.tableContainer /deep/ .el-table th.el-table__cell {
  background-color: transparent;
  color: white;
}
</style>
